﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace MaxStoreErp.Core.Ui.Drop
{
    public class DropBorder : Border
    {
        public Action<DropItem> OnDropItem { get; set; }

        public DropBorder()
        {
            AllowDrop = true;
            Background = new SolidColorBrush(Colors.Transparent);
        }

        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);
            FileSource source;
            var droppedFile = DropHelper.GetDroppedFile(e.Data, out source);
            if (OnDropItem != null)
                OnDropItem(new DropItem(source, droppedFile));
        }
    }
}
